<template>
  <div id="newApp1">
    <!-- <div class="title">标注</div> -->
    <ul>
      <li v-for="(a,b) in list">
        <span class="user">{{a.user}}:</span>
        <span class="content">{{a.content}}</span>
      </li>
    </ul>
    <div>
      <a type="text" class="replayBtn" :id="`${_uuid}_del`">删除</a>
      <a type="text" class="replayBtn" :id="`${_uuid}_replay`">回复</a>
    </div>
  </div>
</template>

<script>
  import {addLabelContent, queryLabelContents,deleteLabelContents} from '@/depends/api/labelContent'

export default {
  components: {
  },
  data() {
    return {
      list: [],
      _this:null,
      _uuid: null
    }
  },
  created() {
    this._this = this.$root.pthis;
    this._uuid = this.$root.uuid
    // this._this.commentBox.newLine.flag = true;

  },
  mounted(){
    this.$nextTick(() => {
      let objDom_replay = document.getElementById(this._uuid+'_replay');
      let objDom_del = document.getElementById(this._uuid +'_del');
      objDom_replay.addEventListener('touchend', (event) => {
        //alert(1111111111111111);
        this.test();
      }, false)
      objDom_replay.addEventListener('click', (event) => {
        this.test();
      }, false)
      objDom_del.addEventListener('touchend', (event) => {
        this.del();
      }, false)
      objDom_del.addEventListener('click', (event) => {
        this.del();
      }, false)

    })
  },
  methods:{
    // add () {
    // },
    setList (a) {
      this.list = a
    },
    addList (a) {
      this.list.push(a)
    },
    test(){
      this._this.newContent(this._uuid)
    },
    del(a){
      let _self=this;
      console.log('modelLabelId--------------',_self.list[0].modelLabelId)
      this.$confirm('确认删除?', '提示', {
        confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
        deleteLabelContents(_self.list[0].modelLabelId).then(res => {
          if (res.data.status !== 200) { return }
          this.$message.success('删除成功!')
          this._this.wssend({type: 3,modelLabelId: this.list[0].modelLabelId,createBy:this._this.userInfo.id.toString(),medicalRecordId:this._this.$route.params.id});
        })
        }).catch(() => {});

    }
    
  }
}
</script>
<style scoped lang="less">
#newApp1 {
  .title {
    background-color: #FFFFF0;
    font-size: 9px;
    line-height: 14px;
    height: 14px;
    text-align: center;
    border-bottom: 1px solid #ccc;
  }
  ul {
    height: calc(100% - 14px);
    font-size: 8px;
    overflow-y: auto;
    padding: 4px;
    margin: 0;
    li {
      border-bottom: 1px dashed #ccc;
      list-style: none;
      padding: 2px;
      word-wrap:break-word;
      word-break:break-all;
      .user {
        margin-right: 4px;
        color: #999;
      }
      .content {
        color: #606266;
      }
    }
    li:last-child {
      border-bottom: none;
    }
  }
  div .replayBtn{
    font-size:10px;
    color:#409eff;
    float:right;
    padding:4px 2px;
    cursor:pointer;
  }
}
</style>
